<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>登录</title>
    <link rel="stylesheet" type="text/css" href="/taobao/css/loaders.min.css"/>
    <link rel="stylesheet" type="text/css" href="/taobao/css/loading.css"/>
    <link rel="stylesheet" type="text/css" href="/taobao/css/base.css"/>
    <link rel="stylesheet" type="text/css" href="/taobao/css/style.css"/>
      <script src="/taobao/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="/js/plugins/layer/layer.js"></script>
    <script type="text/javascript">
    	$(window).load(function(){
    		$(".loading").addClass("loader-chanage")
    		$(".loading").fadeOut(300)
    	})
    </script>
</head>
<!--loading页开始-->
<div class="loading">
	<div class="loader">
        <div class="loader-inner pacman">
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
        </div>
	</div>
</div>
<!--loading页结束-->
<body>
	<header class="top-header">
		<a class="text texta" href="/taobao">取消</a>
		<h3>登录</h3>
		<a class="text" href="/taobao/reg">注册</a>
	</header>
	
	<div class="login">
		<form>
			<ul>
				<li>
					<img src="/taobao/images/login.png"/>
					<label>账号</label>
					<input type="text" id="username" placeholder="请输入账号"/>
				</li>
				<li>
					<img src="/taobao/images/password.png"/>
					<label>密码</label>
					<input type="password" id="password" placeholder="请输入密码"/>
				</li>
			</ul>
			<input type="button" onclick="login()" value="登录"/>
		</form>
	</div>
	<script type="text/javascript">
        function login(){
            var username=$("#username").val();
            var password=$("#password").val();
            if(username=='' || password==''){
                layer.msg("账号或密码为空!");
			}
            $.ajax({
                type: "post",
                url: '/taobao/login',
                data: {
                    username:username,
                    password:password
				},
                dataType: "json",
                success:function(data) {
                    if(data.code==0){
                        window.location.href = "/taobao/person"
                    }else{
                        layer.msg(data.msg);
                    }
                }
            });
        }
	</script>
</body>
</html>